
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.border.Border;

public class Piece extends JButton implements ActionListener
{
	int row;		// The X-Coordinate
	int column;		// The Y-Coordinate
	int color;
	Color Color;		// Determine the stone's color/player
	static int firstPlayerStones = 9;
	static int secondPlayerStones = 9;

	public Piece(int x, int y, int color, Color Color)
	{
		super();
		row = x;
		column = y;
		this.color = color;
		this.Color = Color;
		setBorder(null);
		setContentAreaFilled(false);
		addActionListener(this);
		if(color == 0)
		{
			firstPlayerStones--;
		}
		else
		{
			if(color == 1)
			{
				secondPlayerStones--;
			}
		}
	}

	public void paintComponent(Graphics g)
	{
		g.setColor(this.Color);
		g.drawOval(10, 10, 40, 40);
		g.fillOval(10, 10, 40, 40);
	}

	public void actionPerformed(ActionEvent e)
	{
	}

	int getcolor()
	{
		return this.color;
	}

	Color getColor()
	{
		return this.Color;
	}

	// Getter method for the stone's row
	int getRow()
	{
		return row;
	}

	// Getter method for the stone's column
	int getColumn()
	{
		return column;
	}

	void setPosition(int x, int y)
	{
		row = x;
		column = y;
	}

	public int getRemaining()
	{
		if(this.color == 0)
			return firstPlayerStones;
		else
			return secondPlayerStones;
	}
}
